﻿using System;
using System.Data;
using System.Collections;
using CE.Database;

/// <summary>
/// Summary description for FleetCarFileUploadDB
/// </summary>
namespace CE.CarInsurance
{
    public class FleetCarFileUploadDB
    {
        public Int64 Insert(FleetCarFileUpload fleetcarfileupload)
        {
            MyDatabase _db = new MyDatabase("GG_CRMDBConnectionString");
            Int64 _result = -1;
            string _spName = "sprocCXCRMFleetCarFileUploadDetailInsertUpdateSingleItem";

            SortedList _sPara = new SortedList();

            #region Parameter
            _sPara.Add("@CompanyId", fleetcarfileupload.CompanyId);
            _sPara.Add("@FleetCarId", fleetcarfileupload.FleetCarId);
            _sPara.Add("@ProviderCompanyId", fleetcarfileupload.ProviderCompanyId);
            _sPara.Add("@InsuranceType", fleetcarfileupload.InsuranceType);
            _sPara.Add("@AgentId", fleetcarfileupload.AgentId);
            _sPara.Add("@DocRefNo", fleetcarfileupload.DocRefNo);
            _sPara.Add("@DocumentNo", fleetcarfileupload.DocumentNo);
            _sPara.Add("@FileTypeId", fleetcarfileupload.FileTypeId);
            _sPara.Add("@FileName", fleetcarfileupload.FileName);
            _sPara.Add("@OriginalName", fleetcarfileupload.OriginalName);
            _sPara.Add("@Status", fleetcarfileupload.Status);
            _sPara.Add("@TotalFiles", fleetcarfileupload.TotalFiles);
            #endregion

            _result = _db.ExecuteSP(_spName, _sPara);

            return _result;
        }

        public DataSet GetFleetCarFileUploadList(Int64 FleetCarId, Int64 ProviderCompanyId)
        {
            MyDatabase _db = new MyDatabase("GG_CRMDBConnectionString");
            string _spName = "sprocCXCRMFleetCarFileUploadDetailSelectItemList";

            SortedList _spara = new SortedList();
            _spara.Add("@FleetCarId", FleetCarId);
            _spara.Add("@ProviderCompanyId", ProviderCompanyId);

            DataSet _ds = _db.GetDataSet(_spName, _spara);

            return _ds;
        }

        public DataSet GetFleetCarFileUploadList(Int64 FleetCarId, Int64 ProviderCompanyId, string Language, Int16 Renewal)
        {
            MyDatabase _db = new MyDatabase("GG_CRMDBConnectionString");
            string _spName = "sprocCXCRMFleetCarFileUploadDetailSelectItemList";

            SortedList _spara = new SortedList();
            _spara.Add("@FleetCarId", FleetCarId);
            _spara.Add("@ProviderCompanyId", ProviderCompanyId);
            _spara.Add("@Language", Language);
            _spara.Add("@Renewal", Renewal);

            DataSet _ds = _db.GetDataSet(_spName, _spara);

            return _ds;
        }

    }
}